import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;




public class Connector {

	public static Connection getConnection() throws Exception {
		Class.forName("com.mysql.jdbc.Driver");
		String username = "root";//change to username website??
		String password = null;//change to whatever password
		String url = "jdbc:mysql://127.0.0.1/hello";//change to database website setup
		Connection connection = DriverManager.getConnection(url, username, password);
		connection.setAutoCommit(false);
		return connection;
	}

	public static void closeConnection(PreparedStatement statement,
			ResultSet results, Connection connection) throws Exception {
		if (statement != null) {
			statement.close();
			statement = null;
		}
		if (results != null) {
			results.close();
			results = null;
		}
		if (connection != null) {
			connection.close();
			connection = null;
		}
	}
}
